package com.sf;

public class Node {
    public int data;
    public Node next;
    public Node(int data) {
        this.data = data;
        this.next = null;
    }
    public Node(int data, Node next) {
        this.data = data;
        this.next = next;
    }
    public void printAll() {
        Node p = this;
        while (p != null) {
            System.out.println(p.data);
            p = p.next;
        }
    }
    public void printAll(String msg) {
        System.out.println(msg);
        printAll();
    }
}
